package com.yida.gwj.expend.outside.domain.request;

import java.time.LocalDate;

import com.yida.common.core.exception.ServiceException;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 拨付申请报告手填数据实体
 *
 * @author wkz
 * @date 2023/03/27
 */
@ApiModel(description = "拨付申请报告手填数据实体")
public class ApplyAppropriateReportRequest {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "验收单位")
    private String acceptanceUnit;

    @ApiModelProperty(value = "验收报告出具单位")
    private String acceptanceReportIssuingUnit;

    /**
     * 预算拨出时间(第一次拨款时间)
     */
    @ApiModelProperty(value = "预算拨出时间(第一次拨款时间)")
    private LocalDate budgetAppropriationTime;

    /**
     * 公示时间起始
     */
    @ApiModelProperty(value = "公示时间起始")
    private LocalDate publicityStartTime;

    /**
     * 公示时间终止
     */
    @ApiModelProperty(value = "公示时间终止")
    private LocalDate publicityEndTime;

    /**
     * 公示地点
     */
    @ApiModelProperty(value = "公示地点")
    private String publicityPlace;

    /**
     * 保存时间
     */
    @ApiModelProperty(value = "保存时间")
    private LocalDate saveTime;

    public String getAcceptanceUnit() {
        return acceptanceUnit;
    }

    public void setAcceptanceUnit(String acceptanceUnit) {
        this.acceptanceUnit = acceptanceUnit;
    }

    public String getAcceptanceReportIssuingUnit() {
        return acceptanceReportIssuingUnit;
    }

    public void setAcceptanceReportIssuingUnit(String acceptanceReportIssuingUnit) {
        this.acceptanceReportIssuingUnit = acceptanceReportIssuingUnit;
    }

    public LocalDate getBudgetAppropriationTime() {
        return budgetAppropriationTime;
    }

    public void setBudgetAppropriationTime(LocalDate budgetAppropriationTime) {
        this.budgetAppropriationTime = budgetAppropriationTime;
    }

    public String getPublicityPlace() {
        return publicityPlace;
    }

    public void setPublicityPlace(String publicityPlace) {
        this.publicityPlace = publicityPlace;
    }

    public LocalDate getSaveTime() {
        return saveTime;
    }

    public void setSaveTime(LocalDate saveTime) {
        this.saveTime = saveTime;
    }

    public LocalDate getPublicityStartTime() {
        return publicityStartTime;
    }

    public void setPublicityStartTime(LocalDate publicityStartTime) {
        this.publicityStartTime = publicityStartTime;
    }

    public LocalDate getPublicityEndTime() {
        return publicityEndTime;
    }

    public void setPublicityEndTime(LocalDate publicityEndTime) {
        this.publicityEndTime = publicityEndTime;
    }

    @Override
    public String toString() {
        return "ApplyAppropriateReportRequest{" + "acceptanceUnit='" + acceptanceUnit + '\'' + ", acceptanceReportIssuingUnit='" + acceptanceReportIssuingUnit + '\'' + ", budgetAppropriationTime=" + budgetAppropriationTime + ", publicityStartTime=" + publicityStartTime + ", publicityEndTime=" + publicityEndTime + ", publicityPlace='" + publicityPlace + '\'' + ", saveTime=" + saveTime + '}';
    }

    public void checkNull() {
        if (StrUtil.isBlank(acceptanceUnit)) {
            throw new ServiceException("验收单位不能为空");
        }
        if (StrUtil.isBlank(acceptanceReportIssuingUnit)) {
            throw new ServiceException("验收报告出具单位不能为空");
        }
        if (ObjectUtil.isNull(budgetAppropriationTime)) {
            throw new ServiceException("预算拨出时间(第一次拨款时间)不能为空");
        }
        if (ObjectUtil.isNull(publicityStartTime)) {
            throw new ServiceException("公示起始时间不能为空");
        }
        if (ObjectUtil.isNull(publicityEndTime)) {
            throw new ServiceException("公示终止时间不能为空");
        }
        if (StrUtil.isBlank(publicityPlace)) {
            throw new ServiceException("公示地点不能为空");
        }
        if (ObjectUtil.isNull(saveTime)) {
            throw new ServiceException("保存时间saveTime不能为空");
        }
    }
}
